USE [ERP]
GO

/****** Object:  StoredProcedure [dbo].[SP_CHECK_DIRECTIONS_UPDATE_INSERT]    Script Date: 11/16/2009 14:37:28 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		Yaser
-- Create date: Jul 17 09
-- =============================================
CREATE PROCEDURE [dbo].[SP_CHECK_DIRECTIONS_UPDATE_INSERT]
	-- Add the parameters for the stored procedure here	
	@ID nvarchar(50),
	@Name nvarchar(50),
	@ObsoleteFlag bit
AS
BEGIN
	UPDATE CheckDirections 
		SET Name = @Name ,
		ObsoleteFlag = @ObsoleteFlag
		WHERE ID = @ID
	
	IF @@ROWCOUNT = 0 
	BEGIN
		INSERT INTO CheckDirections (ID, Name )
		VALUES (@ID, @Name)
	END
	
	RETURN @@ROWCOUNT
END

GO

